-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve intrasite links in summaries. #3280
Conversation
ee782e7
to
ceaffef
Compare
ceaffef
to
d39dd9b
Compare
Why? If PS: I really dislike the way |
Backward compatibility, and it stayed because it was late last night and I didn't want to have to (i.e. too tired to) work through the implications of removing it. And, for now, the docs of this warning:
But if you're okay with it, I would be happy remove any reference to it, update the documentation, make sure my plugin is up to date, and try and stick a big enough warning in the release notes.
I've been bitten by this too! If seems rather esoteric and non-obvious, and really only something that's discovered through trial and error. The related part of that is that if you call |
But you did remove it. In |
pelican/contents.py
Outdated
if "summary" in self.settings["FORMATTED_FIELDS"]: | ||
if hasattr(self, "_summary"): | ||
self.metadata["summary"] = self._summary | ||
|
||
if "summary" in self.metadata: | ||
self.metadata["summary"] = self._update_content( | ||
self.metadata["summary"], self.get_siteurl() | ||
) | ||
|
||
if hasattr(self, "_summary") and "summary" in self.metadata: | ||
self._summary = self.metadata["summary"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be precise, I'm talking about the last if
condition here, specifically hasattr(self, "_summary")
. If you compare to the previous version, this if
should not be here and their contents should be combined to ensure that ._summary
and metadata['summary']
are synced:
if "summary" in self.metadata:
self.metadata["summary"] = self._update_content(
self.metadata["summary"], self.get_siteurl()
)
self._summary = self.metadata["summary"]
erh, not quite. The line before was this: self._summary = self._update_content(self._summary, self.get_siteurl()) so if you got into the function without An implicit assumption has become explicit. Is the (preferred) solution to remove the last if condition and just always set |
Sorry, bad choice of words on my part. Previous version had its issues. What I was trying to say is that if you update
Yes, As I wrote above, just update both together: if "summary" in self.metadata:
self.metadata["summary"] = self._update_content(
self.metadata["summary"], self.get_siteurl()
)
self._summary = self.metadata["summary"] |
Done! Thank you for your patience as I get this figured out, and thanks for all your work with Pelican! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks to @MinchinWeb for the fix and for the excellent attention to detail, made all the more robust thanks to the review by @avaris 🤗
Closes #3265
Closes MinchinWeb/minchin.pelican.plugins.summary#5
Changes the order of when intrasite links are resolved, so it is after summary plugins are called.
Also allows
Articles
not to have a_summary
attribute.Related history includes:
{filename}
from URL leaks from summary of the very first post MinchinWeb/minchin.pelican.plugins.summary#5